﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication2.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="http://localhost:43126/socket.io/socket.io.js" type="text/javascript"></script>
    <script type="text/javascript">
        window.onload = function () {
            var input = document.getElementById('input');
            var output = document.getElementById('output');

            var socket = io.connect('localhost', { port: 43126 });

            socket.on("connect", function () {
                console.log("Connected to the server");
            });
            socket.on('message', function (data) {
                output.innerHTML = '=' + data;
            });
            socket.on('error', function (data) {
                console.log("error:", data);
            }
        );

            window.sendMessage = function () {
                socket.send(input.value);
            };
        }
 
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <input type='text' id='input' />
        <span id='output'></span>
        <br/>
        <input type='button' id='send' value='calc' onclick='sendMessage();' />
    </form>
</body>
</html>
